import { ILoadMapTypeAll } from '@/common';
import { ManageCommonAPI } from '@/pages/type';
import { getTenantID } from '@/utils';

/** 合同列表搜索 */
const getContractSearchList = (loadInfo: Record<string, any>): ManageCommonAPI.ISearchList => {
  /** 采购方式 */
  const purchaseTypeList = loadInfo?.loadMapInfo?.[`${getTenantID()}${ILoadMapTypeAll.PURCHASE_METHOD}`];

  return [
    {
      name: 'contractName',
      placeholder: '合同名称',
      label: '合同名称',
      componentType: 'Input',
      allowClear: true,
      md: 6,
      sm: 24,
      whetherSenior: false,
    },
    {
      name: 'contractCode',
      placeholder: '合同编号',
      label: '合同编号',
      componentType: 'Input',
      allowClear: true,
      md: 6,
      sm: 24,
      whetherSenior: false,
    },
    {
      name: 'moneyFrom',
      placeholder: '资金来源',
      label: '资金来源',
      componentType: 'Input',
      allowClear: true,
      md: 6,
      sm: 24,
      whetherSenior: false,
    },
    {
      name: 'procureReal',
      placeholder: '采购方式',
      label: '采购方式',
      componentType: 'TreeSelect',
      allowClear: true,
      md: 6,
      sm: 24,
      whetherSenior: false,
      dataSource: purchaseTypeList,
      fieldNames: {
        label: 'name',
        value: 'id',
        children: 'children',
      },
    },
  ];
};

export { getContractSearchList };
